$(document).ready(function() {
    $("a.voteup").click(function(){
      var that = this;
      var comid = that.id.substring(1);
      $.post(that.href, {commentid: comid, votedirection: 'up', returntype: 'good'}, function(html) {
        var icon = "#imgu"+comid;
        var imgpc = "#imgpc"+comid;
        var assoc = "#imgd"+comid;
        var ciurl = $(icon).attr('src');
        var pcurl = $(imgpc).attr('src');
        $(icon).fadeTo('slow',0.1);
        $(imgpc).fadeTo('slow',0.1);
        $(this).delay(500,function(){
          $(icon).attr('src', ciurl+'&?time='+Math.random());
          $(imgpc).attr('src', pcurl+'&?time='+Math.random());
        });
        $(this).delay(500,function(){
        $(icon).fadeTo('slow',1);
        $(imgpc).fadeTo('slow',1);
        $(icon).click(function(){
        return false;
        });
        $(assoc).click(function(){
        return false;
        });
        });
      });
      return false;
    });
    
    $("a.votedown").click(function(){
      var that = this;
      var comid = that.id.substring(1);
      $.post(that.href, {commentid: comid, votedirection: 'down', returntype: 'bad'}, function(html) {
        var icon = "#imgd"+comid;
        var imgpc = "#imgpc"+comid;
        var assoc = "#imgu"+comid;
        var ciurl = $(icon).attr('src');
        var pcurl = $(imgpc).attr('src');
        $(icon).fadeTo('slow',0.1);
        $(imgpc).fadeTo('slow',0.1);
        $(this).delay(500, function(){
          $(icon).attr('src', ciurl+'&?time='+Math.random())
          $(imgpc).attr('src', pcurl+'&?time='+Math.random())
        });
        $(this).delay(1000, function(){
          $(icon).fadeTo('slow',1);
          $(imgpc).fadeTo('slow',1);
        });
        $(icon).click(function(){
        return false;
        });
        $(assoc).click(function(){
        return false;
        });
      });
      return false;
    });
});



